how to add an ajax jQuery code, that return a row from php file [DB] and then change the value of input text?
Posted
by
Nisreen KH
on Stack Overflow
See other posts from Stack Overflow
or by Nisreen KH
Published on 2012-10-13T21:31:40Z
Indexed on
2012/10/13
21:36 UTC
Read the original article
Hit count: 222
//this is a code in php which is fetch a record from database
<?php
include("dbconn.inc");
$data=mysql_query("SELECT `subtitle`, `mian-title`, `page_num`, `note_path`, `flash_path` FROM `main-page` WHERE `page_num` =".$r." LIMIT 1");
echo $data;
if (mysql_num_rows($data) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($data))
{ echo $row['page_num'];
}
include("close.php");
?>
//and this is a code in html
<form method="post" action="data.php">
<input name="Button1" type="submit" value="<<" />
<input name="test" style="width: 31px; height: 23px" type="text" /> // this is a value of page_num in DB.
<input name="Button2" type="submit" value=">>" >
</form>
//i want to add an ajax code to retrieve the record from php code, and then change the input values depends on returned data ,and also to prevent refreshing the page always!!
© Stack Overflow or respective owner